package io.elegant

import android.content.ClipboardManager
import android.content.Context
/**
 * 获取剪贴板文本
 * */
fun Context.getClipboardText() = (getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager?)
    ?.text
    ?.toString()
/**
 * 设置剪贴板文本
 * @param text 要设置的文本
 * */
fun Context.setClipboardText(text: String?) {
    (getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager?)?.text = text
}